CS 50 Pointers


//  5    <---    
//  k          pk

*pk = 35; // * is de-reference operator, which gets the value where located of the address
==> we go to the address pointed to by pk, and change what we find.
==> k == 35;


// 5  
// k     pk
//    /
// 4
// m
int m;
m = 4;
pk = &m;

the things stored in pk would change to be the address of m, instead of k anymore.
#pointer #& #* #dereference







你可能感興趣的文章

Day 39 & 40 - Flight Deal Finder [BIG project]

Day 39 & 40 - Flight Deal Finder [BIG project]

React 按下編輯按鈕後,想要自動 focus 在內容上

React 按下編輯按鈕後,想要自動 focus 在內容上

[Golang] slice 作為參數傳入 func 的注意事項

[Golang] slice 作為參數傳入 func 的注意事項






留言討論